﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using NUnit.Framework;
using Boggle.Client;

namespace Boggle.Client.Tests
{
    /// <summary>
    /// Tests the GameStateToStringConverter class.
    /// </summary>
    public class TestGameStateToStringConverter
    {
        /// <summary>
        /// Tests the Convert method.
        /// </summary>
        /// <param name="state"></param>
        /// <returns></returns>
        [Test, TestCaseSource("GetConvertCases")]
        public Object TestConvert(Game.GameState state)
        {
            var converter = new GameStateToStringConverter();
            return converter.Convert(state, typeof(String), null, null);
        }

        /// <summary>
        /// Gets test cases for the Convert method.
        /// </summary>
        /// <returns></returns>
        private IEnumerable<ITestCaseData> GetConvertCases()
        {
            yield return new TestCaseData(Game.GameState.Setup).Returns("Game setup");
            yield return new TestCaseData(Game.GameState.InProgress).Returns("Game in progress");
            yield return new TestCaseData(Game.GameState.Ended).Returns("Game ending...");
        }

        /// <summary>
        /// Tests the ConvertBack method.
        /// </summary>
        [Test, ExpectedException(typeof(NotImplementedException))]
        public void TestConvertBack()
        {
            var converter = new GameStateToStringConverter();
            converter.ConvertBack("Game setup", typeof(Game.GameState), null, null);
        }
    }
}
